package net.babypai.widget;

import net.babypai.R;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;

public class AlertShow extends Dialog{

	private ImageView mImageView;
	private TextView loadingText;
	private Animation mAnimation;
	private Context mContext;
	public AlertShow(Context context, int theme) {
		super(context, theme);
		mContext=context;
	}
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.loadingdialog);
		mImageView=(ImageView)findViewById(R.id.loadingdialog_img);
		mAnimation=AnimationUtils.loadAnimation(mContext, R.anim.rotate);
		mImageView.setAnimation(mAnimation);
		mAnimation.startNow();
		loadingText = (TextView) findViewById(R.id.loadingdialog_text);
		setCanceledOnTouchOutside(false);
	}
	
	public void setLoadingText(String str){
		if(loadingText != null)
			loadingText.setText(str);
	}
	
	public void setLoadingText(int resid){
		if(loadingText != null)
			loadingText.setText(resid);
	}
}